package com.zjxny.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.zjxny.proxy.AccountProxy;

import lombok.Getter;
import lombok.Setter;
import xyz.erupt.annotation.Erupt;
import xyz.erupt.annotation.EruptField;
import xyz.erupt.annotation.sub_erupt.Power;
import xyz.erupt.annotation.sub_erupt.Tree;
import xyz.erupt.annotation.sub_field.Edit;
import xyz.erupt.annotation.sub_field.EditType;
import xyz.erupt.annotation.sub_field.View;
import xyz.erupt.annotation.sub_field.sub_edit.BoolType;
import xyz.erupt.annotation.sub_field.sub_edit.ReferenceTreeType;
import xyz.erupt.annotation.sub_field.sub_edit.Search;
import xyz.erupt.upms.model.base.HyperModel;

@Setter
@Getter
@Entity
@Table(name = "account_info")
@Erupt(
		name = "账号信息"
		,dataProxy = AccountProxy.class
		,tree = @Tree(id = "id", label = "title",pid = "parent.id")
		,power = @Power(add = true, delete = false, 
        edit = true, query = true, 
        importable = false, export = false)
)
public class AccountInfo extends HyperModel{

	private static final long serialVersionUID = 2653779833798950879L;
	
	@EruptField(
	        views =  @View(title = "父级公司", column = "simpleTitle"),
    		edit = @Edit(
    		            title = "父级公司"
    		            ,type = EditType.REFERENCE_TREE
    		            ,referenceTreeType = @ReferenceTreeType(pid = "parent.id",label = "simpleTitle")
    		)
	    )
	@ManyToOne
	AccountInfo parent;//注意此处的命名

	@EruptField(
			views = @View(title = "名称")
			,edit = @Edit(
			title="名称"
			,type = EditType.INPUT
			,notNull = true
	)
	)
	private String simpleTitle;

	@EruptField(
			views = @View(title = "完整名称")
			,edit = @Edit(
					title="完整名称"
					,type = EditType.INPUT
					,notNull = true
				)
	)
	private String title;
	
	@EruptField(
			views = @View(title = "账号名称")
			,edit = @Edit(
					title="账号名称"
					,type = EditType.INPUT
					,notNull = true
				)
	)
	private String userName;
	
	@EruptField(
			views = @View(title = "账号密码")
			,edit = @Edit(
					title="账号密码"
					,type = EditType.INPUT
					,notNull = true
				)
	)
	private String passwd;
	
	@EruptField(
			views = @View(title = "交管域名")
			,edit = @Edit(
					title="交管域名"
					,type = EditType.INPUT
				)
	)
	private String domain;
	
	@EruptField(
			views = @View(title = "运维手机号")
			,edit = @Edit(
					title="运维手机号"
					,type = EditType.INPUT
				)
	)
	private String notifyPhoneNo;	
	
	@EruptField(
			views = @View(title = "企业微信号")
			,edit = @Edit(
					title="企业微信号"
					,type = EditType.INPUT
					,show=false
				)
	)
	private String notifyCpName;	
	
	
	@EruptField(
			views = @View(title = "会话信息",show=false)
			,edit = @Edit(
					title="会话信息"
					,type = EditType.TEXTAREA
				)
	)
	@Column(name = "cookies", columnDefinition="mediumtext")
	private String cookies;
	
	@EruptField(
			views = @View(title = "备注")
			,edit = @Edit(
					title="备注"
					,type = EditType.TEXTAREA
				)
	)
	private String content;
	
	
	@EruptField(
			views = @View(title = "有效")
			, edit = @Edit(
                    title = "有效",
                    type = EditType.BOOLEAN
                    ,search = @Search,
                    boolType = @BoolType
            )
	)
	private Boolean isValid=true;

	@EruptField(
			views = @View(title = "非营运业务")
			, edit = @Edit(
				title = "非营运业务",
				type = EditType.BOOLEAN
				,search = @Search,
				boolType = @BoolType
			)
	)
	private Boolean hasNotOperation=true;
	
	@EruptField(
			views = @View(title = "营运业务")
			, edit = @Edit(
				title = "营运业务",
				type = EditType.BOOLEAN
				,search = @Search,
				boolType = @BoolType
			)
	)
	private Boolean hasOperation=true;
	
	@EruptField(
			views = @View(title = "租赁业务")
			, edit = @Edit(
				title = "租赁业务",
				type = EditType.BOOLEAN
				,search = @Search,
				boolType = @BoolType
			)
	)
	private Boolean hasBiz=true;

	@EruptField(
			views = @View(title = "任务状态",show = true)
			, edit = @Edit(
				title = "任务状态"
				,show = true
				,type = EditType.BOOLEAN
				,search = @Search,
				boolType = @BoolType
			)
	)
	private Boolean taskStatus=false;
}